package com.atguigu.ware.wares.service;

import com.atguigu.common.to.es.SkuHasStock;
import com.atguigu.common.to.rabbit.OrderToWaresTo;
import com.atguigu.ware.wares.entity.WmsWareOrderTaskDetailEntity;
import com.atguigu.ware.wares.vo.reqVo.OrderToWareTo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.ware.wares.entity.WmsWareSkuEntity;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author qhw
 * @email qhw@gmail.com
 * @date 2021-08-03 19:16:41
 */
public interface WmsWareSkuService extends IService<WmsWareSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    void addWareSkus(Long skuId,Long wareId,Integer skuNum);

    List<SkuHasStock> skuIdInfo(List<Long> skuIds);

    Boolean orderLock(List<OrderToWareTo> orderToWareTos);
    //解锁库存
    void deblocking(WmsWareOrderTaskDetailEntity entity);
    //查询是否需要解锁库存，需要的话解锁，不需要不解锁
    void boolLocks(String orderSn);

    /**
     * 监听库存解锁方法--自动解锁
     */
    void unlock(WmsWareOrderTaskDetailEntity entity, Message message, Channel channel) throws IOException;

    void orderToWaresTo(OrderToWaresTo entity, Message message, Channel channel) throws IOException;

}

